<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>餐饮后台管理系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0,maximum-scale=1.0, user-scalable=no" />
    <link rel="stylesheet" href="${pageContext.request.contextPath}/admin/static/font-awesome-4.7.0/css/font-awesome.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/admin/static/css/all.css" type="text/css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/admin/static/css/index.css" type="text/css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/admin/static/css/pages-user-profile.css" type="text/css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/admin/static/css/cuisineList.css" type="text/css" />
    <script src="${pageContext.request.contextPath}/admin/static/js/down.js" type="text/javascript"></script>
    <script src="${pageContext.request.contextPath}/admin/static/js/menu.js" type="text/javascript"></script>
    <script src="${pageContext.request.contextPath}/admin/static/js/userbox.js" type="text/javascript"></script>
    <script src="${pageContext.request.contextPath}/admin/static/js/user.js"></script>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    <style>
        body {
            color: #777777;
            background:#FFFFFF;
        }
        .text-home {
            height: 200px;
            color: #12101f;
            text-align: center;
            margin-top: 245px;
            font-size: 45px;
            font-weight: bold;
        }

        .text-home p {
            line-height: 40px;
            margin-bottom: 20px;
        }
        .nav {
            height: 100%;
            position: relative;
            overflow: hidden;
            width: 100%;
            margin-bottom: 0;
            padding-left: 0;
            list-style: none;
        }
        .sidebar-left {
            top: 60px;
            bottom: 0;
            left: 0;
            padding-bottom: 50px;
            position: fixed;
            background: #302b63;
            vertical-align: top;
            width: 300px;
        }

        .page-header {
            background: #302b63;
        }
        .sidebar-left .sidebar-header .sidebar-toggle{
            background-color: #6576ba;
        }
        a{
            color: #966bbf;
        }
    </style>
</head>

<body>
    <section class="body">
        <header class="header">
            <div class="header-left logo-con">
                <a href="${pageContext.request.contextPath}/admin/index" class="logo">FOOD</a>
            </div>
            <div class="header-right">
                <%--                <form action="pages-search-results.html" class="search">--%>
                <%--                    <div class="input-group input-search">--%>
                <%--                        <input type="text" class="form-control" name="search-a" id="search-a" placeholder="搜索...">--%>
                <%--                        <button class="btn btn-default" type="submit" style="color: #ccc;padding: 0;background-color: #fff;">--%>
                <%--									<i class="fa fa-search"></i>--%>
                <%--						</button>--%>
                <%--                    </div>--%>
                <%--                </form>--%>
                <%--                <span class="separator"></span>--%>
                <%--                <ul class="notifications">--%>
                <%--                    <li>--%>
                <%--                        <a href="#" class="dropdown-order notification-icon">--%>
                <%--                            <i style="font-size:17px" class="fa">&#xf233</i>--%>
                <%--                            <span class="badge">--%>
                <%--									<font style="vertical-align: inherit;">0</font>--%>
                <%--								</span>--%>
                <%--                        </a>--%>
                <%--                    </li>--%>
                <%--                    <li>--%>
                <%--                        <a href="#" class="dropdown-order notification-icon">--%>
                <%--                            <i style="font-size:17px" class="fa">&#xf0e0</i>--%>
                <%--                            <span class="badge">--%>
                <%--									<font style="vertical-align: inherit;">0</font>--%>
                <%--								</span>--%>
                <%--                        </a>--%>
                <%--                    </li>--%>
                <%--                    <li>--%>
                <%--                        <a href="#" class="dropdown-order notification-icon">--%>
                <%--                            <i style="font-size:17px" class="fa">&#xf0f3</i>--%>
                <%--                            <span class="badge">--%>
                <%--									<font style="vertical-align: inherit;">0</font>--%>
                <%--								</span>--%>
                <%--                        </a>--%>
                <%--                    </li>--%>
                <%--                </ul>--%>
                <span class="separator"></span>
                <div id="button" class="userbox">
                    <a href="#" data-toggle="dropdown">
                        <figure class="profile-picture">
                            <img src="static/images/user.jpg" alt="舒克·张" class="img-circle" data-lock-picture="头像">
                        </figure>
                        <div class="profile-info" data-lock-name="舒克" data-lock-email="337828925@qq.com">
                            <span class="name">
									<font style="vertical-align: inherit;">${admin.adminName}</font>
								</span>
                            <span class="role">
									<font style="vertical-align: inherit;">营业额:￥${admin.turnover}</font>
								</span>
                        </div>
                        <i style="font-size:18px;font-weight: bold;color: #777777;" class="fa">&#xf107</i>
                    </a>
                    <div class="dropdown-menu">
                        <ul class="list-unstyled">
                            <li class="divider"></li>
                            <li>
                                <a href="${pageContext.request.contextPath}/admin/adminInformation">
                                    <font style="vertical-align: inherit;">个人资料</font>
                                </a>
                            </li>
                            <li>
                                <a href="${pageContext.request.contextPath}/admin/adminRegister">
                                    <i style="font-size:24px" class="fa">&#xf007</i>
                                    <font style="vertical-align: inherit;">注册</font>
                                </a>
                            </li>
                            <li>
                                <a href="${pageContext.request.contextPath}/admin/adminLogout">
                                    <i style="font-size:24px" class="fa">&#xf011</i>
                                    <font style="vertical-align: inherit;" type="button" id="logout">退出</font>
                                </a>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </header>
        <div class="inner-wrapper">
            <aside id="sidebar-left" class="sidebar-left">
                <div class="sidebar-header">
                    <div class="sidebar-toggle">
                        <a href="${pageContext.request.contextPath}/admin/index">
                            <i style="font-size:20px" class="fa">&#xf00b</i>
                        </a>
                    </div>
                </div>
                <div class="nav scrollbar">
                    <div class="nav-content">
                        <nav id="menu" role="navigation">
                            <ul class="nav-main" id="list">
                                <li class="nav-parent">
                                    <a>
                                        <i style="font-size:24px" class="fa">&#xf0f6</i>
                                        <span>
                                            <font style="vertical-align: inherit;"> 菜单管理</font>
                                    </span>
                                    </a>
                                    <ul class="nav nav-children">
                                        <li>
                                            <a href="${pageContext.request.contextPath}/admin/cuisineList" id="page_1">
                                                <font style="vertical-align: inherit;">菜单列表</font>
                                            </a>

                                        </li>
                                        <li>
                                            <a href="${pageContext.request.contextPath}/admin/cuisineAdd" id="page_2">
                                                <font style="vertical-align: inherit;">添加菜单</font>
                                            </a>
                                        </li>
                                    </ul>
                                </li>
                                <li >
                                    <a href="${pageContext.request.contextPath}/admin/cartList">
                                        <i class="fa fa-shopping-cart" style="font-size: 24px" aria-hidden="true"></i>
                                        <span>
                                        <font style="vertical-align: inherit;">购物车</font>
                                    </span>
                                    </a>

                                </li>
                                <li class="nav-parent">
                                    <a>
                                        <i style="font-size:24px" class="fa">&#xf2c0</i>
                                        <span>
                                        <font style="vertical-align: inherit;">订单管理</font>
                                    </span>
                                    </a>
                                    <ul class="nav nav-children">
                                        <li>
                                            <a href="${pageContext.request.contextPath}/admin/orderList?index=1&payFlag=1">
                                                <font style="vertical-align: inherit;">已支付订单</font>
                                            </a>
                                            <a href="${pageContext.request.contextPath}/admin/orderList?index=1&payFlag=0">
                                                <font style="vertical-align: inherit;">未支付订单</font>
                                            </a>
                                        </li>
                                    </ul>
                                </li>
                                <li class="nav-parent">
                                    <a>
                                        <i style="font-size:24px" class="fa">&#xf2c0</i>
                                        <span>
                                        <font style="vertical-align: inherit;">分类管理</font>
                                    </span>
                                    </a>
                                    <ul class="nav nav-children">
                                        <li>
                                            <a href="${pageContext.request.contextPath}/admin/categoryAdd">
                                                <font style="vertical-align: inherit;">添加分类</font>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="${pageContext.request.contextPath}/admin/categoryList">
                                                <font style="vertical-align: inherit;">分类列表</font>
                                            </a>
                                        </li>
                                    </ul>
                                </li>
                            </ul>
                        </nav>
                    </div>
                </div>
            </aside>
            <section class="content-body">
                <header class="page-header">
                    <h2>
                        <font style="vertical-align: inherit;color: #fff;font-weight: 500;">用户资料</font>
                    </h2>
                </header>
                <div class="row">
<%--                    <section class="panel">--%>
<%--                        <div class="panel-body">--%>
<%--                            <div class="thumb-info">--%>
<%--                                <img src="./img/user.jpg" class="img-user">--%>
<%--                                <div class="thumb-info-title">--%>
<%--                                    <span class="thumb-info-inner">吹气球的葫芦娃</span>--%>
<%--                                    <span class="thumb-info-type">管理员</span>--%>
<%--                                </div>--%>
<%--                            </div>--%>
<%--                            <div class="widget-expand">--%>
<%--                                <h4>个人简介</h4>--%>
<%--                                <hr style="height: 0;border-bottom: 1px dotted #ddd;margin: 11px 0 11px 0;">--%>
<%--                                <h5 style="color: #999999;">格言</h5>--%>
<%--                                <p style="font-size: 13px;">一直被模仿，从未被超越。</p>--%>
<%--                                <hr style="height: 0;border-bottom: 1px dotted #ddd;margin: 11px 0 11px 0;">--%>
<%--                                <div class="social-icons-list">--%>
<%--                                    <a rel="tooltip" data-placement="bottom" target="_blank" href="https://mail.qq.com/" data-original-title="QQ">--%>
<%--                                        <i style="font-size:16px" class="fa">&#xf1d6</i>--%>
<%--                                    </a>--%>
<%--                                    <a rel="tooltip" data-placement="bottom" href="https://weixin.qq.com/" data-original-title="WeChat">--%>
<%--                                        <i style="font-size:16px" class="fa">&#xf1d7</i>--%>
<%--                                    </a>--%>
<%--                                    <a rel="tooltip" data-placement="bottom" href="https://weibo.com/?sudaref=www.baidu.com&display=0&retcode=6102" data-original-title="Weibo">--%>
<%--                                        <i style="font-size:16px" class="fa">&#xf18a</i>--%>
<%--                                    </a>--%>
<%--                                </div>--%>
<%--                            </div>--%>
<%--                        </div>--%>
<%--                    </section>--%>
                    <div class="tabs">
<%--                        <ul class="nav nav-tabs tabs-primary">--%>
<%--                            <li>--%>
<%--                                <a href="#">--%>
<%--                                    <input value="查询" type="button" id="overview" style="border: none;background-color: white;padding: 10px 22.5px;">--%>
<%--                                </a>--%>
<%--                            </li>--%>
<%--                            <li>--%>
<%--                                <a href="#">--%>
<%--                                    <input value="编辑" type="button" id="change" style="border: none;background-color: transparent;padding: 10px 22px;">--%>
<%--                                </a>--%>
<%--                            </li>--%>
<%--                        </ul>--%>
                        <div class="tab-content">
                            <div class="tab-pane" id="edit1" style="display: block;">
                                <form class="overview-cont">
                                    <h4 style="margin-bottom: 30px;">个人资料</h4>
                                    <fieldset>
                                        <div class="form-group">
                                            <label class="control-label">
                                                <font style="vertical-align: inherit;">账号</font>
                                            </label>
                                            <input type="text" class="form-control-user" id="userName" placeholder="337828925@qq.com">
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label">
                                                <font style="vertical-align: inherit;">手机号</font>
                                            </label>
                                            <input type="text" class="form-control-user" id="userTEL" placeholder="15136708003">
                                        </div>
                                    </fieldset>
                                </form>
                            </div>
<%--                            <div id="edit2" class="tab-pane" style="display: none;">--%>
<%--                                <form class="form-horizontal">--%>
<%--                                    <h4 style="margin-bottom: 30px;">个人信息</h4>--%>
<%--                                    <fieldset>--%>
<%--                                        <div class="form-group">--%>
<%--                                            <label class="control-label">--%>
<%--                                                <font style="vertical-align: inherit;">账号</font>--%>
<%--                                            </label>--%>
<%--                                            <input type="text" class="form-control-user" id="userId">--%>
<%--                                        </div>--%>
<%--                                        <div class="form-group">--%>
<%--                                            <label class="control-label">--%>
<%--                                                <font style="vertical-align: inherit;">名字</font>--%>
<%--                                            </label>--%>
<%--                                            <input type="text" class="form-control-user" id="userName">--%>
<%--                                        </div>--%>
<%--                                        <div class="form-group">--%>
<%--                                            <label class="control-label">--%>
<%--                                                <font style="vertical-align: inherit;">性别</font>--%>
<%--                                            </label>--%>
<%--                                            <input type="text" class="form-control-user" id="userSex">--%>
<%--                                        </div>--%>
<%--                                        <div class="form-group">--%>
<%--                                            <label class="control-label">--%>
<%--                                                <font style="vertical-align: inherit;">手机号</font>--%>
<%--                                            </label>--%>
<%--                                            <input type="text" class="form-control-user" id="userTel">--%>
<%--                                        </div>--%>
<%--                                    </fieldset>--%>
<%--                                    <hr style="height: 0;border-bottom: 1px dotted #ddd;margin: 44px 0 44px 0;">--%>
<%--                                    <h4 style="margin-bottom: 30px;">关于自己</h4>--%>
<%--                                    <fieldset>--%>
<%--                                        <div class="form-group">--%>
<%--                                            <label class="control-label">--%>
<%--                                                <font style="vertical-align: inherit;">履历</font>--%>
<%--                                            </label>--%>
<%--                                            <textarea class="form-control-user" id="profileBio" style="min-width: 422px;"></textarea>--%>
<%--                                        </div>--%>
<%--                                    </fieldset>--%>
<%--                                    <div class="panel-footer">--%>
<%--                                        <div class="row">--%>
<%--                                            <div class="footer-btn">--%>
<%--                                                <button type="button" class="btn btn-primary" id="changeUser">提交</button>--%>
<%--                                                <button type="reset" class="btn btn-default">重置</button>--%>
<%--                                            </div>--%>
<%--                                        </div>--%>
<%--                                    </div>--%>
<%--                                </form>--%>
<%--                            </div>--%>
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </section>
    <script type="text/javascript">
        // 查询用户信息
        $(document).ready(function() {
            $("#overview").click(function() {
                var _id = $("#userName").val();
                $.ajax({
                    type: 'POST',
                    url: 'http://39.105.232.109:3000/user/getInfoById',
                    data: {
                        _id: _id
                    },
                    success: function(data) {
                        console.log(data)
                    }
                });
                $.ajax({
                    url: 'http://39.105.232.109:3000/user/getLoginUser',
                    type: 'GET',

                    success: function(data) {
                        alert(data.msg)
                    }
                });
            });
        });
        // 编辑用户信息
        $(document).ready(function() {
            $("#changeUser").click(function() {
                var id = $('#userId').val();
                var name = $('#userName').val();
                var sex = $('#userSex').val();
                var tel = $('#userTel').val();
                $.ajax({
                    url: 'http://39.105.232.109:3000/user/updata',
                    type: 'POST',
                    data: {
                        _id: "5e986a8962548461237b31a5",
                        name: name,
                        sex: sex,
                        tel: tel
                    },
                    success: function(data) {
                        if (data.err = 0) {
                            window.location.href = 'pages-user-profile.html'
                        } else {
                            alert(data.msg)
                        }
                    }
                });
            });
        });
        // 用户退出
        $(document).ready(function() {
            $("#logout").click(function() {
                $.ajax({
                    url: 'http://39.105.232.109:3000/user/logout',
                    type: 'POST',
                    dataType: "JSON",

                    success: function(data) {
                        if (data.err == -999) {
                            window.location.href = 'login.html'
                            localStorage.removeItem("login_id")
                        } else {
                            alert(data.msg)
                        }
                        alert("确定退出码？");
                        // console.log(data);
                    }
                });

            });
        });
    </script>
</body>